﻿@model IEnumerable<ShareIt_MVC3.Models.User>

@{
    ViewBag.Title = "Index";
    var colorCheck = true;
}


<div class="post">
<h1>Alle Benutzer</h1>

<p>
    @Html.ActionLink("Neuen Benutzer anlegen", "Create")
</p>
<table>
    <tr>
        
        <th>
            Benutzername
        </th>
        <th>
           Nachname
        </th>
        <th>
            Vorname
        </th>
        <th>
            E-Mail-Adresse
        </th>
        <th>
            Aktiv
        </th>
        <th>
            Admin
        </th>
        <th>
            Credits
        </th>
        <th>Aktionen</th>
    </tr>

@foreach (var item in Model) {
 <tr @((colorCheck == true) ? "class=colored-row" : "")>
 
        <td>
            @item.Username
        </td>
        <td>
            @item.Surname
        </td>
        <td>
            @item.Name
        </td>
        <td>
            @item.EMail
        </td>
        <td>
            @item.Active
        </td>
        <td>
            @item.IsAdmin
        </td>
        <td>
            @item.Credits
        </td>
               <td>
            @Html.ActionLink("Editieren", "Edit", new { id = item.ID }) 

        </td>
    </tr>
    
    if (colorCheck == false)
    {
        colorCheck = true;
    }
    else
    {
        colorCheck = false;
    }
}

</table>

</div>